<? 
$text= $text."<script type=\"text/javascript\"> 
<!-- 
function PlayIt(){
document.getElementById(\"music1\").innerHTML='<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" width=\"320\" '
      +'height=\"255\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\">'
      +'<param name=\"src\" value=\"'+document.getElementById('cancion').value+'\">'
      +'<param name=\"autoplay\" value=\"true\">'
      +'<param name=\"controller\" value=\"true\">'
      +'<param name=\"loop\" value=\"false\">'
      +'<embed src=\"'+document.getElementById('cancion').value+'\" autoplay=\"true\" width=\"300\" heigth=\"50\"'
      +'controller=\"true\" loop=\"true\" pluginspage=\"http://www.apple.com/quicktime/download/\"></embed>'
+'</object>'
}
//-->
</script>
<form name=\"player\" action=\"\" method=\"\">";


//$url=$DOC_ROOT.$username_dir."/";   
if (is_dir($url)) 
{
	if ($dir = opendir($url)) 
	{
#		echo "<table border=1>";
		while (false !== ($file = readdir($dir)))
		{
			if ($file != "." && $file != "..")
			{
				$files++;	
			}
		}
		$text= $text."<select name=\"\" id=\"cancion\" onchange=\"PlayIt()\" size=\"".$files."\" width=\"40%>\"";
#					<option value=\"none\">ТЕСТ!!</option>";
		
	}
	closedir($dir);
	if ($dir = opendir($url))
	{
		$c=1;
		while (false !== ($file = readdir($dir)))
		{
			if ($file != "." && $file != "..") 
			{
#				echo "<tr><td>";
#				echo $file."<br/>";
				if ($c = 1) $mp3filename_first = $url.$file;
				$c++;
				
				$mp3filename1 = $url.$file;
				$tag=mp3_tags_read($mp3filename1);
				$tag = str_replace('\"' ,'"' ,$tag);
						
				$text= $text."<option value=\"http://www.xepec.ru/".$username_dir."/".$file."\">{$tag['title']} : {$tag['artist']}</option>";
				$text= $text."\n";
#				echo '<br>Название: ' . $tag['title'] . "<br>"; 
#				echo 'Исполнитель: ' . $tag['artist']. "<br>"; 
#				echo 'Альбом: ' . $tag['album'] . "<br>"; 
#				echo 'Год: ' . $tag['year'] . "<br>"; 
#				echo "</tr></td>";
			}
		}
	}
	//Закрываем директорию
	closedir($dir);
}
$text= $text."
</select>
</form>
<span id=\"music1\">
    <!--<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" width=\"320\"
        height=\"255\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0\">
        <param name=\"src\" value=\"\">
        <param name=\"autoplay\" value=\"true\">
        <param name=\"controller\" value=\"true\">
        <param name=\"loop\" value=\"true\">
        <embed src=\"\" width=\"320\" height=\"255\" autoplay=\"true\"
        controller=\"true\" loop=\"true\">
        </embed>
        </object>-->
	
	<object classid=\"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b\"
	codebase=\"http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0\">
	<param name=\"src\" value=\"\" />
	<param name=\"autoplay\" value=\"true\">
	<param name=\"controller\" value=\"true\">
	<param name=\"loop\" value=\"false\">
	<embed src=\"".$mp3filename_first."\" width=\"320\" height=\"50\" autoplay=\"true\" controller=\"true\" loop=\"true\" type=\"audio/mpeg\">
	</embed>
	</object>
</span>";
?>